import { serviceCreate } from '../utils/request'
import { merge } from 'axios/lib/utils'
const http = serviceCreate({
  // baseURL: '/dv',
  // 表单提交
  emulateJSON: true
})
// @config {headers, emulateJSON, loading, msg, errMsg, disableInterceptor}
const methods = {
    // 获取文章内容
    getContent (params, config) {
        params = merge({
            id: '',
            jsonp: 'jsonp'
        }, params || {})
        return http.get('/article/content', merge(config, { params }))
    },
    // 获取文章里面的视频
    getContentVideo (params, config) {
        params = merge({
            id: '',
            // 视频ids
            ids: '',
            mobi_api: 'h5',
            from: '',
            jsonp: 'jsonp'
        }, params || {})
        return http.get('/article/videos', merge(config, { params }))
    },
    // 获取文章的相关信息
    getInfo (params, config) {
        params = merge({
            id: '',
            mobi_api: 'h5',
            from: '',
            jsonp: 'jsonp'
        }, params || {})
        return http.get('/article/about', merge(config, { params }))
    },
    // 获取推荐文章
    getRecommend(params, config) {
        params = merge({
            aid: '',
            jsonp: 'jsonp'
        }, params || {})
        return http.get('/article/more', merge(config, { params }))
    },
    // 获取文章评论
    getComments(params, config) {
        params = merge({
            oid: '',
            type: 12
        }, params || {})
        return http.get('/article/comments', merge(config, { params }))
    }
}

export default methods
